group { "efl/tab_bar";
   data.item: "version" "123";
   parts {
      swallow { "efl.content";
         desc { "default";
         }
      }
   }
}

group { "efl/tab_bar/tab";
   data.item: "version" "123";
   data.item: "transition_animation_on" "1";

   images.image: "win_shad_flat.png" COMP;

#define ICON    1
#define LABEL   2
#define MASK    3
#define DISABLE 4
   script {
      public btmode;
      public eval_mode(m) {
         new m1 = m & MASK;
         new d = m & DISABLE;
         if (m1 == (ICON | LABEL)) {
            if (!d) {
               set_state(PART:"efl.icon", "default", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"efl.text", "default", 0.0);
            } else {
               set_state(PART:"efl.icon", "default", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"efl.text", "disabled", 0.0);
            }
         } else if (m1 == (ICON)) {
            if (!d) {
               set_state(PART:"efl.icon", "icononly", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"efl.text", "icononly", 0.0);
            } else {
               set_state(PART:"efl.icon", "icononly", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"efl.text", "icononly", 0.0);
            }
         } else if (m1 == (LABEL)) {
            if (!d) {
               set_state(PART:"efl.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"efl.text", "noicon", 0.0);
            } else {
               set_state(PART:"efl.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"efl.text", "noicon_disabled", 0.0);
            }
         } else {
            if (!d) {
               set_state(PART:"efl.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"efl.text", "noicon", 0.0);
            } else {
               set_state(PART:"efl.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"efl.text", "noicon_disabled", 0.0);
            }
         }
      }
   }
   parts {
      part { name: "shadow"; type: RECT;
         description { state: "default" 0.0;
            rel1.to_x: "_sh1";
            rel1.to_y: "_sh1";
            rel2.to_x: "_sh1";
            rel2.to_y: "";
            color: 255 255 255 128; // no cc
            color_class: "/shadow/normal/tab";
         }
         desc { "selected";
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
      }
      WIN_SHAD("base", "shadow", "win_shad_flat.png", 10, 10, 7, 14, 0.25)
      rect { "base";
         desc { "default";
            color_class: "/bg/normal/tab";
         }
         desc { "vert";
            inherit: "default" 0.0;
         }
      }
      rect { "inset_clip";
         desc { "default";
            rel.to: "base";
            color: 255 255 255 128; // no cc
         }
         desc { "selected";
            inherit;
            hid;
         }
      }
      image { "inset";
         clip_to: "inset_clip";
         scale;
         desc { "default";
            image.normal: "win_shad_flat.png";
            image.border: 44 44 44 44;
            image.border_scale: 1;
            image.border_scale_by: 0.25;
            fill.smooth: 1;
            rel.to: "base";
            rel1.relative: 0.0 1.0;
            rel1.offset: -22 -11;
            rel2.offset: 21 20;
            color_class: "/shadow/normal/tab";
            offscale;
         }
      }
      rect { "highlight";
         desc { "default";
            rel.to: "base";
            hid;
            color_class: "/bg/selected/tab/hilight";
         }
         desc { "selected";
            inherit: "default" 0.0;
            vis;
         }
      }
      rect { "icon_clip";
         desc { "default";
         }
         desc { "disabled";
            inherit: "default";
            color: 255 255 255 64; // no cc
         }
      }
      rect { "icon_clip1";
         clip_to: "icon_clip";
         desc { "default";
            color: 255 255 255 255; // no cc
            vis;
         }
         desc { "animation";
            inherit: "default";
            color: 255 255 255 0; // no cc
            hid;
         }
      }
      swallow { "efl.icon";
         clip_to: "icon_clip1";
         scale;
         desc { "default";
            align: 0.5 0.5;
            rel1.offset: 4 4;
            rel2.to_y: "efl.text";
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            offscale;
         }
         desc { "noicon";
            inherit: "default" 0.0;
            hid;
            rel1.offset: 4 0;
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 0;
         }
         desc { "icononly";
            inherit: "default" 0.0;
            vis;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
            rel2.to_y: "";
         }
      }
      rect { "icon_clip2";
         clip_to: "icon_clip";
         desc { "default";
            color: 255 255 255 0; // no cc
            hid;
         }
         desc { "animation";
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            vis;
         }
      }
      swallow { "efl.icon_new";
         clip_to: "icon_clip2";
         scale;
         desc { "default";
            align: 0.5 0.5;
            rel1.relative: 0.0 0.0;
            rel1.offset: 4 4;
            rel2.to_y: "efl.text";
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            offscale;
         }
         desc { "noicon";
            inherit: "default" 0.0;
            hid;
            rel1.offset: 4 0;
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 0;
         }
         desc { "icononly";
            inherit: "default" 0.0;
            vis;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
            rel2.to_y: "";
         }
      }
      rect { "text_clip1";
         desc { "default";
            color: 255 255 255 255; // no cc
            vis;
         }
         desc { "animation";
            inherit: "default";
            color: 255 255 255 0; // no cc
            hid;
         }
      }
      text { "efl.text";
         nomouse;
         scale;
         clip_to: "text_clip1";
         desc { "default";
            rel1.offset: 4 0;
            rel1.relative: 0.0 1.0;
            rel2.offset: -5 -5;
            align: 0.5 1.0;
            color_class: "/fg/normal/tab/text";
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.5 0.5;
               text_class: "toolbar_item";
            }
            fixed: 0 1;
         }
         desc { "selected";
            inherit: "default";
            color_class: "/fg/selected/tab/text";
         }
         desc { "disabled";
            inherit: "default";
            color_class: "/fg/disabled/tab/text";
         }
         desc { "noicon";
            inherit: "default";
            rel1.offset: 4 4;
            rel1.relative: 0.0 0.0;
            align: 0.5 0.5;
         }
         desc { "noicon_disabled";
            inherit: "noicon";
            color_class: "/fg/disabled/tab/text";
         }
         desc { "icononly";
            inherit: "default";
            text.min: 0 0;
            hid;
            fixed: 1 1;
         }
      }
      rect { "text_clip2";
         desc { "default";
            color: 255 255 255 0; // no cc
            hid;
         }
         desc { "animation";
            inherit: "default";
            color: 255 255 255 255; // no cc
            vis;
         }
      }
      rect { "bar";
         nomouse;
         scale;
         desc { "default";
            fixed: 0 1;
            rel.to: "base";
            min: 0 0;
            max: -1 0;
            align: 0.5 0.0;
            color_class: "/bg/selected/tab/bar";
            hid;
         }
         desc { "selected";
            inherit: "default";
            min: 0 0;
            max: -1 5;
            vis;
         }
      }
      rect { "event";
         desc { "default";
            color: 0 0 0 0; // no cc
         }
      }
      swallow { "efl.extra";
         scale;
         desc { "default";
            fixed: 1 1;
            align: 1.0 0.0;
            rel1.relative: 1.0 0.0;
            rel1.offset: -5 4;
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 4;
            offscale;
         }
      }
   }
   programs {
      EFL_UI_CLICKABLE_PART_BIND(event)
      program { signal: "efl,state,horizontal"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "base";
      }
      program { signal: "efl,state,vertical"; source: "efl";
         action: STATE_SET "vert" 0.0;
         target: "base";
      }
      program { signal: "load"; source: "";
         script {
            set_int(btmode, LABEL | ICON);
         }
      }
      program { signal: "efl,state,selected"; source: "efl";
         action: STATE_SET "selected" 0.0;
         target: "efl.text";
         target: "shadow";
         target: "bar";
         target: "inset_clip";
      }
      program { signal: "efl,state,unselected"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "efl.text";
         target: "shadow";
         target: "bar";
         target: "inset_clip";
      }
      program { signal: "efl,highlight,on"; source: "efl";
         action: STATE_SET "selected" 0.0;
         target: "highlight";
      }
      program { signal: "efl,highlight,off"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "highlight";
      }
      program { signal: "efl,text,unset"; source: "efl";
         script {
            new m = get_int(btmode);
            m &= ~LABEL; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { signal: "efl,text,set"; source: "efl";
         script {
            new m = get_int(btmode);
            m |= LABEL; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { signal: "efl,state,icon,unset"; source: "efl";
         script {
            new m = get_int(btmode);
            m &= ~ICON; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { signal: "efl,state,icon,set"; source: "efl";
         script {
            new m = get_int(btmode);
            m |= ICON; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { signal: "efl,state,disabled"; source: "efl";
         script {
            new m = get_int(btmode);
            m |= DISABLE; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { signal: "efl,state,enabled"; source: "efl";
         script {
            new m = get_int(btmode);
            m &= ~DISABLE; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { signal: "efl,state,moving"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "shadow";
      }
      program { signal: "efl,state,icon_new,set"; source: "efl";
         action: STATE_SET "animation" 0.0;
         target: "icon_clip1";
         target: "icon_clip2";
         transition: LINEAR 0.2;
         after: "icon_set,animation,done";
      }
      program { name: "icon_set,animation,done";
         action: SIGNAL_EMIT "efl,state,icon_set,done" "efl";
      }
      program { signal: "efl,state,icon,reset"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "icon_clip1";
         target: "icon_clip2";
      }
      program { signal: "efl,state,label_set,forward"; source: "efl";
         after: "label_set,animation";
      }
      program { signal: "efl,state,label_set,backward"; source: "efl";
         after: "label_set,animation";
      }
      program { name: "label_set,animation";
         signal: "efl,state,label_set"; source: "efl";
         action: STATE_SET "animation" 0.0;
         target: "text_clip1";
         target: "text_clip2";
         transition: LINEAR 0.2;
         after: "label_set,animation,done";
      }
      program { name: "label_set,animation,done";
         action: SIGNAL_EMIT "efl,state,label_set,done" "efl";
      }
      program { signal: "efl,state,label,reset"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "text_clip1";
         target: "text_clip2";
      }
   }
#undef ICON
#undef LABEL
#undef MASK
#undef DISABLE
}
